package chapter19;

/**
 * @author lzy
 * @version v1.0
 * Create DateTime: 2019/4/2 8:54
 */
enum Shrubbery {GROUND, CRAWLING, HANGING}

public class EnumClass {
    public static void main(String[] args) {
        for (Shrubbery value : Shrubbery.values()) {
            System.out.println(value + " ordinal: " + value.ordinal());
            System.out.println(value.compareTo(Shrubbery.CRAWLING));
            System.out.println(value.equals(Shrubbery.CRAWLING));
            System.out.println(value == Shrubbery.CRAWLING);
            System.out.println(value.getDeclaringClass());
            System.out.println(value.name());
            System.out.println("----------------------");
        }

        for (String s : "HANGING CRAWLING GROUND".split(" ")) {
            Shrubbery shrubbery = Enum.valueOf(Shrubbery.class, s);
            System.out.println(shrubbery);
        }
    }
}
